<?
require("vstar_config.php");
$Err="";
if(isset($_POST["submit"]))
{
		$TenDN=addslashes($_POST["user_login"]);
		$MatKhau=md5($_POST["user_pass"]);
		$sql="select * from vstar_admin where TenDN='$TenDN' AND MatKhau='$MatKhau'";
		//echo $sql;
		$result=mysql_query($sql);
		if(mysql_num_rows($result))
		{
			$rows=mysql_fetch_array($result);
			$_SESSION['is_admin'] = true;
			$_SESSION["IdAdmin"]=$rows["ID"];
			$_SESSION["Acc"]=$rows["TenDN"];
			header("Location:index.php");
		}
		else
		{
			$_SESSION['is_admin'] = false;
			$Err="<font color=\"#FF0000\"><b>Thông tin đăng nhập không đúng</b></font>";
		}
	
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="author" content="Vstar">
<meta name="owner" content="VStar">
<title>Chocuatui > Admin Login</title>
<link rel="stylesheet" type="text/css" href="css/global.css" >
</head>
<body class="login">
	<div id="login">
		<h1>
			<a href="">CHOCUATUI.VN</a>
		</h1>
		<form id="loginform" method="post" name="loginform" action="">
			<p>
				<label>
					Username
					<br>
					<input id="user_login" class="input" type="text" tabindex="10" size="20" value="" name="user_login">
				</label>
			</p>
			<p>
				<label>
					Password
					<br>
					<input id="user_pass" class="input" type="password" tabindex="20" size="20" value="" name="user_pass">
				</label>
			</p>
			<p class="submit">
				<input class="btnSubmit" name="submit" id="submit" type="submit" value="OK" />
			</p>
		</form>
		<p id="backtohome">
			<a title="Về trang chủ" href="http://chocuatui.vn">← Trở về Chocuatui.vn</a>
		</p>
	</div>
</body></html>